var uus;

//ajax请求-无参
function ajaxForm(url, type, success) {
    $.ajax({
        url: url,
        type: type,
        dataType: "json",
        headers: {
            "token": localStorage.token
        },
        success: success,
        error: function (xhr) {
            alert("登录超时！");
            location.href="/login";
        }
    });
}

//ajax请求-带参
function ajaxFormWithArgs(url, type, args, success) {
    $.ajax({
        url: url,
        type: type,
        data: args,
        dataType: "json",
        headers: {
            "token": localStorage.token
        },
        success: success,
        error: function (xhr) {
            alert("请求出错：" + xhr.status);
        }
    });
}

function getU() {
    $.ajaxSettings.async=false;
    ajaxForm("view/getUserOfLogin", "get", function (dataA) {
        uus = dataA.data.name;
    })
    $.ajaxSettings.async=true;
}